package com.sugon.springboot.controller;

import com.sugon.springboot.bean.Userbean;
import com.sugon.springboot.util.JwtUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;


import javax.validation.Valid;
import javax.xml.transform.Result;
@Controller
public class LoginController {
    @GetMapping("/")
    public String returnIndex(){
        JwtUtil.createToken(1,"u","p");
        return "index";
    }
    @GetMapping("/login")
    public String login(Userbean userbean,Model model){
        userbean.setToken(JwtUtil.createToken(1,userbean.getUsername(),userbean.getPassword()));
        model.addAttribute("user",userbean);
        return "redirect:/payment/nacos/2?token=123";
    }


}
